package com.rambler.api.fileupload;

import com.rambler.api.config.FeignMultipartSupportConfig;
import com.rambler.common.response.CommonResponse;
import com.rambler.api.fileupload.dto.FileUploadDTO;
import com.rambler.api.fileupload.vo.FileUploadVO;
import io.swagger.v3.oas.annotations.Parameter;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.multipart.MultipartFile;

/**
 * @author suhao
 */
@FeignClient(name = "homelab-fileupload-service", configuration = FeignMultipartSupportConfig.class)
public interface FileUploadProxy {

    @PostMapping(value = "/fs/upload", consumes = "multipart/form-data")
    CommonResponse<FileUploadVO> upload(
            @RequestPart("file") MultipartFile file,
            @RequestParam("path") String path,
            @RequestParam(value = "uploadType") String uploadType,
            @RequestParam(value = "isPublic") String isPublic,
            @RequestParam(value = "outputFormat") String outputFormat,
            @RequestParam(value = "quality") String quality,
            @RequestParam(value = "crop") String crop,
            @RequestParam(value = "resize") String resize
    );

    @PostMapping("/fs/getById")
    CommonResponse<FileUploadVO> selectById(String id);
}
